 
<?php
function grillehorraire1($date){
include_once("connect.php");
$result=mysql_query("select heure from ap3_sp_rdv where dateRDV='".$date."' ");
    $occuper=array();
while($h=mysql_fetch_assoc($result))
    $occuper[]=$h['heure']; 
for ($i=9; $i<19;$i++)
{
echo "<tr><td rowspan='5'>".$i."h</td>";
for ($j=0; $j<4; $j++)
{  echo "<tr><td>".(15*$j)."</td><td><input type='checkbox' name='heure[]' value='".$i."h".(15*$j)."' ";
  foreach($occuper as $oc)
    {  if (strcmp($oc,$i."h".(15*$j))==false)
          echo "disabled";}
  echo " /> </td></tr>";
echo "</tr>";}
} 
}
function grillehorraire($date){
include_once("connect.php");
$result=mysql_query("select heure from ap3_sp_rdv where dateRDV='".$date."' ");
    $occuper=array();
while($h=mysql_fetch_assoc($result))
    $occuper[]=$h['heure'];
echo "<table>";
	echo "<tr>"; 
		echo "<td class='colonneHeure'>";
			echo "<table class='heureRDV'><tr><td class='mms'>Matin</td></tr>";     
			for ($i=9; $i<=11;$i++){
				echo "<tr><td rowspan='5'>".$i."h</td>";
for ($j=0; $j<4; $j++)
{  echo "<tr><td>".(15*$j)."</td><td><input type='checkbox' name='heure[]' value='".$i."h".(15*$j)."' ";
  foreach($occuper as $oc)
    {  if (strcmp($oc,$i."h".(15*$j))==false)
          echo "disabled";}
  echo " /> </td></tr>";
echo "</tr>";}
} 
echo "</table>";
echo "<table class='heureRDV'><td class='mms'>Midi</td></tr>";
for ($i=12; $i<=13;$i++)
{
echo "<tr><td rowspan='5'>".$i."h</td>";
for ($j=0; $j<4; $j++)
{  echo "<tr><td>".(15*$j)."</td><td><input type='checkbox' name='heure[]' value='".$i."h".(15*$j)."' ";
  foreach($occuper as $oc)
    {  if (strcmp($oc,$i."h".(15*$j))==false)
          echo "disabled";}
  echo " /> </td></tr>";
echo "</tr>";}
}
echo "</table>";
echo "</td>";
echo "<td class='colonneHeure'>";
echo "<table class='heureRDV'><td class='mms'>Aprés-midi</td></tr>"; 
for ($i=14; $i<19;$i++)
{
echo "<tr><td rowspan='5'>".$i."h</td>";
for ($j=0; $j<4; $j++)
{  echo "<tr><td>".(15*$j)."</td><td><input type='checkbox' name='heure[]' value='".$i."h".(15*$j)."' ";
  foreach($occuper as $oc)
    {  if (strcmp($oc,$i."h".(15*$j))==false)
          echo "disabled";}
  echo " /> </td></tr>";
echo "</tr>";}
}
echo "</table>"; 
echo "</td>";
echo "</tr>";
echo "</table>";
}
 
 ?>   
<div id='tableau'>
  <title>placer des rendez vous
  </title>
  <form action="verouiller_rdv.php" method="post"> 
    <input type='hidden' name='date' value=<?php echo $_GET['date']; ?>>
    <input type='hidden' name='page' value='verouiller_rdv'/>
    <input type="submit" value="envoyer" />
<?php
grillehorraire($_GET['date']);
    ?>
  </form>
</div>